import { createRouter, createWebHistory } from 'vue-router'

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/login',
      component: () => import('@/views/LoginView.vue'),
    },
    {
      path: '/',
      component: () => import('@/components/Layout/indexLayout.vue'),
      redirect: '/login',
      children: [
        {
          path: '/Home',
          component: () => import('@/components/Home/IndexHome.vue'),
        },
        {
          path: '/ManageView', //管理
          component: () => import('@/views/ManageView.vue'),
          redirect: '/ManageView/Subhome',
          children: [
            {
              // 子首页
              path: '/ManageView/Subhome',
              component: () => import('@/components/Manage/Subhome/SubhomeManage.vue'),
            },
            {
              path: '/ManageView/Area',
              component: () => import('@/components/Manage/Area/AreaManage.vue'),
            },
            {
              //产品
              path: '/ManageView/Product',
              component: () => import('@/components/Manage/Product/ProductManage.vue'),
            },
            {
              //收支
              path: '/ManageView/Revenue',
              component: () => import('@/components/Manage/Revence/RevenceManage.vue'),
            },
            {
              //采集
              path: '/ManageView/Gather',
              component: () => import('@/components/Manage/Gather/GatherManage.vue'),
            },
          ],
        },
        {
          path: '/ServiceView', //农技服务
          component: () => import('@/views/ServiceView.vue'),
          redirect: '/ServiceView/Science',
          children: [
            {
              //农业资讯
              path: '/ServiceView/Science',
              component: () => import('@/components/Service/Science/Science.vue'),
            },
            {
              //品种库
              path: '/ServiceView/Variety',
              component: () => import('@/components/Service/Variety/Variety.vue'),
            },
            {
              path: '/ServiceView/Consult',
              component: () => import('@/components/Service/Consult/Consult.vue'),
            },
          ],
        },
        {
          path: '/MoniterView', //监测
          component: () => import('@/views/MoniterView.vue'),
          redirect: '/MoniterView/Meteorology',
          children: [
            {
              //气象
              path: '/MoniterView/Meteorology',
              component: () => import('@/components/Moniter/Meteorology/Meteorology.vue'),
            },
            {
              //鱼苗
              path: '/MoniterView/Fry',
              component: () => import('@/components/Moniter/Fry/Fry.vue'),
            },
            {
              //水质
              path: '/MoniterView/Water',
              component: () => import('@/components/Moniter/Water/Water.vue'),
            },
            {
              //预警
              path: '/MoniterView/Early',
              component: () => import('@/components/Moniter/EarlyWarning/EarlyWarning.vue'),
              children: [
                {
                  path: '/Moniter/Early/Setting',
                  component: () => import('@/components/Moniter/EarlyWarning/Setting/Setting.vue'),
                },
                {
                  path: '/Moniter/Early/Rule',
                  component: () => import('@/components/Moniter/EarlyWarning/Rule/Rule.vue'),
                },
                {
                  path: '/Moniter/Early/Strategy',
                  component: () =>
                    import('@/components/Moniter/EarlyWarning/Strategy/Strategy.vue'),
                },
                {
                  path: '/Moniter/Early/Record',
                  component: () => import('@/components/Moniter/EarlyWarning/Record/Record.vue'),
                },
              ],
            },
          ],
        },
        {
          path: '/TraceabilityView', //溯源
          component: () => import('@/views/TraceabilityView.vue'),
          redirect: '/TraceabilityView/Commodity',
          children: [
            {
              path: '/TraceabilityView/Batch',
              component: () => import('@/components/Traceability/Batch/Batch.vue'),
            },
            {
              path: '/TraceabilityView/Commodity',
              component: () => import('@/components/Traceability/Commodity/Commodity.vue'),
            },
            {
              path: '/TraceabilityView/Label/',
              component: () => import('@/components/Traceability/Label/Label.vue'),
            },
          ],
        },
      ],
    },
  ],
})

export default router
